package com.leo.javase.thread.blog;

/**
 * 内部类共享资源
 * @author Administrator
 *
 */
public class TestInnerThread {
	private int index = 0;
	
	class InnerThread extends Thread{
		@Override
		public void run() {
			for(int i=0; i<10; i++)
				System.out.println(++index);
		}
	}
	
	public Thread getThread(){
		return new InnerThread();
	}
	
	public static void main(String[] args) {
		TestInnerThread mt = new TestInnerThread();
		mt.getThread().start();
		mt.getThread().start();
	}
}
